﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace PCManagerReloaded.Model
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IPcInfoService
    {
        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        TimeSpan GetPCStartUpTime();

        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        List<FileEntry> GetMarkedLookedFiles();

        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        void MarkFilesAsLooked(List<FileEntry> lookedFiles);
        
        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        DateTime GetStartUpTime();

        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        void ShutDown();

        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        void CancelShutDown();

        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        bool IsShutdownRequested();

        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        List<FileEntry> GetFileInformation();

        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        List<FileEntry> GetGeGucktFileInformation();

        [OperationContract]
        [FaultContract(typeof (UserFriendlyError))]
        void DeleteFileEntries(IEnumerable<FileEntry> filesToDelete);

        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        DateTime GetLastSystemShutdown();

        [OperationContract]
        [FaultContract(typeof(UserFriendlyError))]
        LogFile GetLogFile(string fileName);

        [OperationContract]
        List<string> GetLogFileMetaData();
    }

    [DataContract]
    public class UserFriendlyError
    {
        [DataMember]
        public string Message { get; set; }
    }

    [DataContract]
    public class FileEntry
    {
        [DataMember]
        public string Name { get; set; }

         [DataMember]
        public DateTime CreationTime { get; set; }

         [DataMember]
        public string Path { get; set; }
    }

    [DataContract]
    public class LogFile
    {
        [DataMember]
        public string FileName { get; set; }

        [DataMember]
        public string Content { get; set; }
    }
}
